<template>
  <div>
    <el-table
      :data="tableData"
      border
      style="width: 100%">
      <el-table-column
        prop="id"
        label="编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="手机号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱"
        width="180">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="时间"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
    </el-table>
    <el-pagination
      small
      align="right"
      layout="prev, pager, next"
      :total="totals"
      :page-size="pageSize"
      :current-page="currentPage"
      @current-change="change"
    >
    </el-pagination>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: 'myTable',
  data () {
    return {
      tableData: [],
      currentPage:1,
      pageSize:10,
      total:0
    }
  },
  methods:{
    change(add) {
      console.log(add)
      this.currentPage=add
      this.public()
    },
    public(){
      let request={"currentPage":this.currentPage,"pageSize":this.pageSize}
      axios.post("/user/list",request)
      .then(result=>{
        this.totals=result.data.totals
        this.tableData=result.data.rows
      }).catch(result =>{
        alert("异常错误")

      })
    }
  },
  mounted() {
    this.public()
  }
}
</script>


